238 ◾ Bioinformatics
#get the NCBI Entrez IDs
entrez1 <- chip1_annot$geneId
# Obtain the gene symbols for the set of Entrez IDs from the
database
annotations_edb1 <- AnnotationDbi::select(EnsDb.Hsapiens.v75,
keys = entrez1,
columns = c(“GENENAME”),
keytype = “ENTREZID”)
#Convert IDs to character type to merge
annotations_edb1$ENTREZID
<- as.character(annotations_edb1$ENTREZID)
# Write Chip1 annotation to file
chip1_annot %>% left_join(annotations_edb1,
by=c(“geneId”=”ENTREZID”)) %>%
write.table(file=”Chip1_peak_annotation.txt”,
sep=”\t”, quote=F, row.names=F)
# Write Chip2 annotation to a file
chip2_annot <- data.frame(annotated_peaks[[“chip2”]]@anno)
entrez2 <- chip2_annot$geneId
annotations_edb2 <- AnnotationDbi::select(EnsDb.Hsapiens.v75,
keys = entrez2,
columns = c(“GENENAME”),
keytype = “ENTREZID”)
FIGURE 6.15 Distribution of Poly II relative to the TSS.